package com.gopay.common.domain;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.constants.cust.UserInfoConstants;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 国付宝用户信息表
 *
 * @UserInfo.java
 * @author zhanglei
 * @2013-1-11 上午10:41:12 www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "USER_INFO")
public class UserInfo extends BaseEntity{
    private static final long serialVersionUID = -7496202219095355329L;
    private String userId;
    private Integer version;
    private String email;
    private String operId;
    private String operName;
    private String password;
    private String passwordQues;
    private String passwordQuesAns;
    private String userType;
    private String userStat;
    private Date regTime;
    private Date lastLoginTime;
    private String lastLoginIp;
    private String activateCode;
    private BigDecimal securetyLevel;
    private String userResource;
    private String custId;
    private Date createdTs;
    private Date lastUpdTs;
    private String lastUpdTrancode;
    private Integer pwdQuesErrNum;
    private Integer ispwdQuesLock;
    private Integer pwdErrNum;
    private Date pwdLockTime;
    private Date pwdQuesLockTime;
    private String operDepartment;
    private String operMobile;
    private String operTel;
    private String operPosition;

    private String ssoUserId;
    private String userSource;
    private String acctAuth;
    
    //增加公告后是否首次登陆
    private String isFirstLogin=UserInfoConstants.NOT_FIRST_LOGIN;
    
    //一账通账号，未关联为空
    private String hnaUserName;

    /**
     * 登陆密码过期时间
     */
    private Date passwordDeadline;

    private String reservedMsg;//客户预留信息

    /**
     * 登录密码状态
     */
    private Integer pwdStat;
    
    //操作员邮箱
    private String operEmail;
    
    //是否接收退款通知邮件
    private String refundNotifyFlag;


    /**
     * 商户后台是否展示数字证书相关内容
     */
    private String showCa;
    
    /**
     * 商户是否展示商财通
     */
    private String showCorpFund;
    
    @Id
    @Column(name = "USER_ID", unique = true, nullable = false, length = 10)
    public String getUserId() {
        return this.userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Version
    @Column(name = "VERSION", nullable = false, precision = 22, scale = 0)
    public Integer getVersion() {
        return this.version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Column(name = "EMAIL", nullable = true, length = 50)
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name = "OPER_ID", nullable = true, length = 3)
    public String getOperId() {
        return this.operId;
    }

    public void setOperId(String operId) {
        this.operId = operId;
    }

    @Column(name = "OPER_NAME", nullable = true, length = 30)
    public String getOperName() {
        return operName;
    }

    public void setOperName(String operName) {
        this.operName = operName;
    }

    @Column(name = "PASSWORD", length = 150)
    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "PASSWORD_QUES", length = 150)
    public String getPasswordQues() {
        return this.passwordQues;
    }

    public void setPasswordQues(String passwordQues) {
        this.passwordQues = passwordQues;
    }

    @Column(name = "PASSWORD_QUES_ANS", length = 150)
    public String getPasswordQuesAns() {
        return this.passwordQuesAns;
    }

    public void setPasswordQuesAns(String passwordQuesAns) {
        this.passwordQuesAns = passwordQuesAns;
    }

    @Column(name = "USER_TYPE", nullable = false, length = 2)
    public String getUserType() {
        return this.userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    @Column(name = "USER_STAT", nullable = false, length = 2)
    public String getUserStat() {
        return this.userStat;
    }

    public void setUserStat(String userStat) {
        this.userStat = userStat;
    }

    @Column(name = "REG_TIME", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getRegTime() {
        return this.regTime;
    }

    public void setRegTime(Date regTime) {
        this.regTime = regTime;
    }

    @Column(name = "LAST_LOGIN_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastLoginTime() {
        return this.lastLoginTime;
    }

    public void setLastLoginTime(Date lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    @Column(name = "LAST_LOGIN_IP", length = 50)
    public String getLastLoginIp() {
        return this.lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    @Column(name = "ACTIVATE_CODE", length = 10)
    public String getActivateCode() {
        return this.activateCode;
    }

    public void setActivateCode(String activateCode) {
        this.activateCode = activateCode;
    }

    @Column(name = "SECURETY_LEVEL", precision = 22, scale = 0)
    public BigDecimal getSecuretyLevel() {
        return this.securetyLevel;
    }

    public void setSecuretyLevel(BigDecimal securetyLevel) {
        this.securetyLevel = securetyLevel;
    }

    @Column(name = "USER_RESOURCE", length = 10)
    public String getUserResource() {
        return this.userResource;
    }

    public void setUserResource(String userResource) {
        this.userResource = userResource;
    }

    @Column(name = "CUST_ID", length = 10)
    public String getCustId() {
        return this.custId;
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    @Column(name = "CREATED_TS", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreatedTs() {
        return this.createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Column(name = "LAST_UPD_TS", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastUpdTs() {
        return this.lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Column(name = "LAST_UPD_TRANCODE", length = 6)
    public String getLastUpdTrancode() {
        return this.lastUpdTrancode;
    }

    public void setLastUpdTrancode(String lastUpdTrancode) {
        this.lastUpdTrancode = lastUpdTrancode;
    }

    /**
     * @return the pwdQuesErrNum
     */
    @Column(name = "PWD_QUES_ERR_NUM", length = 6)
    public Integer getPwdQuesErrNum() {
        return pwdQuesErrNum;
    }

    /**
     * @param pwdQuesErrNum
     *            the pwdQuesErrNum to set
     */
    public void setPwdQuesErrNum(Integer pwdQuesErrNum) {
        this.pwdQuesErrNum = pwdQuesErrNum;
    }

    /**
     * @return the ispwdQuesLock
     */
    @Column(name = "IS_PWD_QUES_LOCK")
    public Integer getIspwdQuesLock() {
        return ispwdQuesLock;
    }

    /**
     * @param ispwdQuesLock
     *            the ispwdQuesLock to set
     */
    public void setIspwdQuesLock(Integer ispwdQuesLock) {
        this.ispwdQuesLock = ispwdQuesLock;
    }

    /**
     * @return the pwdErrNum
     */
    @Column(name = "PWD_ERR_NUM", length = 6)
    public Integer getPwdErrNum() {
        return pwdErrNum;
    }

    /**
     * @param pwdErrNum
     *            the pwdErrNum to set
     */
    public void setPwdErrNum(Integer pwdErrNum) {
        this.pwdErrNum = pwdErrNum;
    }

    /**
     * @return the pwdLockTime
     */
    @Column(name = "PWD_LOCK_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getPwdLockTime() {
        return pwdLockTime;
    }

    /**
     * @param pwdLockTime
     *            the pwdLockTime to set
     */
    public void setPwdLockTime(Date pwdLockTime) {
        this.pwdLockTime = pwdLockTime;
    }

    /**
     * @return the pwdQuesLockTime
     */
    @Column(name = "PWD_QUES_LOCK_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getPwdQuesLockTime() {
        return pwdQuesLockTime;
    }

    /**
     * @param pwdQuesLockTime
     *            the pwdQuesLockTime to set
     */
    public void setPwdQuesLockTime(Date pwdQuesLockTime) {
        this.pwdQuesLockTime = pwdQuesLockTime;
    }

    @Column(name = "OPER_DEPARTMENT")
    public String getOperDepartment() {
        return operDepartment;
    }

    public void setOperDepartment(String operDepartment) {
        this.operDepartment = operDepartment;
    }

    @Column(name = "OPER_MOBILE")
    public String getOperMobile() {
    	/**
		 * modify by ssj，2017-4-10 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
		 */
		this.operMobile = SensitiveInfoUtils.autoReencrypt(this.operMobile);
		return SensitiveInfoUtils.smartDecryptWithCheck(this.operMobile);
//        return operMobile;
    }

    public void setOperMobile(String operMobile) {
    	/**
		 * modified by ssj，2017-4-10 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
		 */
		this.operMobile = SensitiveInfoUtils.smartEncryptWithCheck(operMobile);
//        this.operMobile = operMobile;
    }

    @Column(name = "OPER_TEL")
    public String getOperTel() {
        return operTel;
    }

    public void setOperTel(String operTel) {
        this.operTel = operTel;
    }

    @Column(name = "OPER_POSITION")
    public String getOperPosition() {
        return operPosition;
    }

    public void setOperPosition(String operPosition) {
        this.operPosition = operPosition;
    }

    /**
     * @return the pwdStat
     */
    @Column(name = "PWD_STAT")
    public Integer getPwdStat() {
        return pwdStat;
    }

    /**
     * @param pwdStat
     *            the pwdStat to set
     */
    public void setPwdStat(Integer pwdStat) {
        this.pwdStat = pwdStat;
    }
    @Column(name = "SSO_USER_ID")
	public String getSsoUserId() {
		return ssoUserId;
	}

	public void setSsoUserId(String ssoUserId) {
		this.ssoUserId = ssoUserId;
	}
	@Column(name = "USER_SOURCE")
	public String getUserSource() {
		return userSource;
	}

	public void setUserSource(String userSource) {
		this.userSource = userSource;
	}
	
	@Column(name = "HNA_USER_NAME")
	public String getHnaUserName() {
		return hnaUserName;
	}


	public void setHnaUserName(String hnaUserName) {
		this.hnaUserName = hnaUserName;
	}

	@Column(name = "OPER_EMAIL")
	public String getOperEmail() {
		return operEmail;
	}

	public void setOperEmail(String operEmail) {
		this.operEmail = operEmail;
	}

	@Column(name = "REFUND_NOTIFY_FLAG")
	public String getRefundNotifyFlag() {
		return refundNotifyFlag;
	}

	public void setRefundNotifyFlag(String refundNotifyFlag) {
		this.refundNotifyFlag = refundNotifyFlag;
	}

    

    @Column(name = "password_deadline", nullable = true)
    @Temporal(TemporalType.TIMESTAMP)
    public Date getPasswordDeadline() {
        return passwordDeadline;
    }

    public void setPasswordDeadline(Date passwordDeadline) {
        this.passwordDeadline = passwordDeadline;
    }

    @Column(name = "RESERVED_MSG")
    public String getReservedMsg() {
        return reservedMsg;
    }

    public void setReservedMsg(String reservedMsg) {
        this.reservedMsg = reservedMsg;
    }

    @Column(name = "SHOW_CA", nullable=true)
    public String getShowCa() {
        return showCa;
    }

    public void setShowCa(String showCa) {
        this.showCa = showCa;
    }
    @Column(name = "IS_FIRST_LOGIN")
    public String getIsFirstLogin() {
        return isFirstLogin;
    }

    public void setIsFirstLogin(String isFirstLogin) {
        this.isFirstLogin = isFirstLogin;
    }
    @Column(name = "SHOW_CORP_FUND")
    public String getShowCorpFund() {
        return showCorpFund;
    }
    
    public void setShowCorpFund(String showCorpFund) {
        this.showCorpFund = showCorpFund;
    }

    @Column(name = "ACCT_AUTH")
    public String getAcctAuth() {
        return acctAuth;
    }

    public void setAcctAuth(String acctAuth) {
        this.acctAuth = acctAuth;
    }
}
